<?php
if (!defined('APP_ID')) { die('No direct script access allowed'); }

class Cookie {
	public static function get($var, $default = null) {
		return Arr::get($_COOKIE, $var, $default);
	}	

	public static function set($var, $val) {
		$expire = time() + intval(Config::get('expire', 'cookie', 3600));
		$path = Config::get('path', 'cookie', '/');
		$domain = Config::get('domain', 'cookie', '');
		$secure = Config::get('secure', 'cookie', false);
		$httponly = Config::get('httponly', 'cookie', false);
		setcookie($var, $val, $expire, $path, $domain, $secure, $httponly);
	}	

	public static function delete($var) {
		$expire = time() - 3600;
		$path = Config::get('path', 'cookie', '/');
		$domain = Config::get('domain', 'cookie', '');
		$secure = Config::get('secure', 'cookie', false);
		$httponly = Config::get('httponly', 'cookie', false);
		setcookie($var, '', $expire, $path, $domain, $secure, $httponly);
	}	

	public static function is($var) {
	}
}
